<?php
/**
 * Created by PhpStorm.
 * User: FDG367
 * Date: 2017/9/29
 * Time: 15:08
 */
namespace common\helps;

use yii;
class StringHelper extends yii\helpers\StringHelper{

	/***
	 * @param 返回随机字符串
	 * @param int $minLength最小长度
	 * @param int $maxLength最大长度
	 * @return string
	 */
	public static function randString($minLength=6,$maxLength=6) {
		$length = mt_rand($minLength, $maxLength);

		$letters = 'bcdfghjklmnpqrstvwxyz123456789';
		$vowels = 'aeiu';
		$randString = '';
		for ($i = 0; $i < $length; ++$i) {
			if ($i % 2 && mt_rand(0, 10) > 2 || !($i % 2) && mt_rand(0, 10) > 9) {
				$randString .= $vowels[mt_rand(0, 3)];
			} else {
				$randString .= $letters[mt_rand(0, 29)];
			}
		}

		return $randString;
	}
}